/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extras;

import java.awt.event.KeyEvent;

/**
 *
 * @author Diego
 */
public class validacao
{

    public static void digitoOuLetra(KeyEvent e)
    {
        if (!Character.isLetterOrDigit(e.getKeyChar()) && e.getKeyChar() != ' ')
        {

            //e.setKeyChar('\0');  
            e.consume();
        }
    }

    public static void digito(KeyEvent e)
    {
        if ((!Character.isDigit(e.getKeyChar())))
        {
            //e.setKeyChar('\0');  
            e.consume();
        }
    }

    public static void digitoFloat(KeyEvent e)
    {
        if (!Character.isDigit(e.getKeyChar()) && e.getKeyChar() != '.')
        {
            //e.setKeyChar('\0');  
            e.consume();
        }
    }
}
